﻿<shared:UserControlBase x:Class="Miris.HumanMilkAnalyser.WPF.CustomizedUserControl.PatientInfoInputUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:shared="clr-namespace:Miris.HumanMilkAnalyser.WPF.Shared"
             xmlns:userControl="clr-namespace:Miris.HumanMilkAnalyser.WPF.CustomizedUserControl"
             xmlns:validationRule="clr-namespace:Miris.HumanMilkAnalyser.WPF.ValidationRules"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="1000">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <!-- Label -->
                <ColumnDefinition Width="160" />
                <!-- Input -->
                <ColumnDefinition Width="Auto" />
                <!-- Label -->
                <ColumnDefinition />
                <!-- Input -->
                <ColumnDefinition Width="Auto" />
                <!-- Label -->
                <ColumnDefinition />
                <!-- Input -->
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
            </Grid.RowDefinitions>
            <Label Grid.ColumnSpan="6" HorizontalAlignment="Left" Content="婴儿信息" Width="119" Height="35" Style="{StaticResource InputLabel}" />
            <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <TextBlock Margin="0,0,6,0" Style="{StaticResource RequiredFieldIndicatorTextBlock}" />
                <TextBlock Text="姓名：" Style="{StaticResource RegularTextBlock}" />
            </StackPanel>
            <TextBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyName">
                        <Binding.ValidationRules>
                            <validationRule:BabyNameValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <StackPanel Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <TextBlock Margin="0,0,6,0" Style="{StaticResource RequiredFieldIndicatorTextBlock}" />
                <TextBlock Text="出生日期：" Style="{StaticResource RegularTextBlock}" />
            </StackPanel>
            <userControl:DatePickerUserControl Grid.Column="3" Grid.Row="1" SelectedDate="{Binding BabyBirthday}" />
            <StackPanel Grid.Column="4" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <TextBlock Margin="0,0,6,0" Style="{StaticResource RequiredFieldIndicatorTextBlock}" />
                <TextBlock Text="性别：" Style="{StaticResource RegularTextBlock}" />
            </StackPanel>
            <StackPanel Grid.Column="5" Grid.Row="1" Orientation="Horizontal">
                <RadioButton Margin="0,0,30,0" Padding="0,0,6,0" Content="男" FontSize="22">
                    <RadioButton.Style>
                        <Style TargetType="{x:Type RadioButton}" BasedOn="{StaticResource BigRadioButton}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsGirl}" Value="False">
                                    <Setter Property="IsChecked" Value="True" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </RadioButton.Style>
                </RadioButton>
                <RadioButton Padding="0,0,6,0" Content="女" FontSize="22" IsChecked="{Binding IsGirl}" Style="{StaticResource BigRadioButton}" />
            </StackPanel>
            <TextBlock Grid.Row="2" Text="身长(CM)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyHeight">
                        <Binding.ValidationRules>
                            <validationRule:BabyHeightValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="2" Grid.Row="2" Text="体重(KG)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="3" Grid.Row="2" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyWeight">
                        <Binding.ValidationRules>
                            <validationRule:BabyWeightValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="4" Grid.Row="2" Text="是否早产：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <StackPanel Grid.Column="5" Grid.Row="2" Orientation="Horizontal">
                <RadioButton Margin="0,0,30,0" Padding="0,0,6,0" Content="是" FontSize="22">
                    <RadioButton.Style>
                        <Style TargetType="{x:Type RadioButton}" BasedOn="{StaticResource BigRadioButton}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsBabyNotPrematureDelivery}" Value="False">
                                    <Setter Property="IsChecked" Value="True" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </RadioButton.Style>
                </RadioButton>
                <RadioButton Padding="0,0,6,0" Content="否" FontSize="22" IsChecked="{Binding IsBabyNotPrematureDelivery}" Style="{StaticResource BigRadioButton}" />
            </StackPanel>
            <TextBlock Grid.Row="3" Text="头围(CM)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyHeadCircumference">
                        <Binding.ValidationRules>
                            <validationRule:BabyHeadCircumferenceValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="2" Grid.Row="3" Text="出生身长(CM)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="3" Grid.Row="3" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyBirthHeight" Converter="{StaticResource NullableValueBindingConverter}">
                        <Binding.ValidationRules>
                            <validationRule:BabyBirthHeightValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="4" Grid.Row="3" Text="出生体重(KG)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="5" Grid.Row="3" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyBirthWeight" Converter="{StaticResource NullableValueBindingConverter}">
                        <Binding.ValidationRules>
                            <validationRule:BabyBirthWeightValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Row="4" Text="出生头围(CM)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="1" Grid.Row="4" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="BabyBirthHeadCircumference" Converter="{StaticResource NullableValueBindingConverter}">
                        <Binding.ValidationRules>
                            <validationRule:BabyBirthHeadCircumferenceValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="2" Grid.Row="4" Text="Apgar评分：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="3" Grid.Row="4" HorizontalAlignment="Left" Width="150" Height="35" 
                         Text="{Binding Apgar, Converter={StaticResource NullableValueBindingConverter}}" 
                         Style="{StaticResource InfoTextBox}" />
        </Grid>
        <Grid Grid.Row="1" Margin="0,20,0,0">
            <Grid.ColumnDefinitions>
                <!-- Label -->
                <ColumnDefinition Width="140" />
                <!-- Input -->
                <ColumnDefinition Width="Auto" />
                <!-- Label -->
                <ColumnDefinition />
                <!-- Input -->
                <ColumnDefinition Width="Auto" />
                <!-- Label -->
                <ColumnDefinition />
                <!-- Input -->
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
            </Grid.RowDefinitions>
            <Label Grid.ColumnSpan="6" HorizontalAlignment="Left" Content="母亲信息" Width="119" Height="35" Style="{StaticResource InputLabel}" />
            <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <TextBlock Margin="0,0,6,0" Style="{StaticResource RequiredFieldIndicatorTextBlock}" />
                <TextBlock Text="姓名：" Style="{StaticResource RegularTextBlock}" />
            </StackPanel>
            <TextBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="MotherName">
                        <Binding.ValidationRules>
                            <validationRule:MotherNameValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="2" Grid.Row="1" Text="年龄：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="MotherAge">
                        <Binding.ValidationRules>
                            <validationRule:MotherAgeValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="4" Grid.Row="1" Text="身高(CM)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="5" Grid.Row="1" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="MotherHeight">
                        <Binding.ValidationRules>
                            <validationRule:MotherHeightValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Row="2" Text="体重(KG)：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="MotherWeight">
                        <Binding.ValidationRules>
                            <validationRule:MotherWeightValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Column="2" Grid.Row="2" Text="BMI：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="3" Grid.Row="2" HorizontalAlignment="Left" Width="150" Height="35" IsReadOnly="True" Text="{Binding MotherBMI}" Style="{StaticResource InfoTextBox}" />
            <TextBlock Grid.Column="4" Grid.Row="2" Text="情绪：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="5" Grid.Row="2" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="MotherEmotion" Converter="{StaticResource NullableValueBindingConverter}">
                        <Binding.ValidationRules>
                            <validationRule:MotherEmotionValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <StackPanel Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <TextBlock Margin="0,0,6,0" Style="{StaticResource RequiredFieldIndicatorTextBlock}" />
                <TextBlock Text="开奶时间：" Style="{StaticResource RegularTextBlock}" />
            </StackPanel>
            <userControl:DatePickerUserControl Grid.Column="1" Grid.Row="3" SelectedDate="{Binding MotherOpenMilkDate}" />
            <StackPanel Grid.Column="2" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <TextBlock Margin="0,0,6,0" Style="{StaticResource RequiredFieldIndicatorTextBlock}" />
                <TextBlock Text="分娩方式：" Style="{StaticResource RegularTextBlock}" />
            </StackPanel>
            <ComboBox Grid.Column="3" Grid.Row="3" FontSize="18" Text="{Binding MotherDeliveryMode}" HorizontalAlignment="Left" Width="150" Height="35">
                <ComboBoxItem IsSelected="True" Content="自然顺产" />
                <ComboBoxItem Content="剖宫产" />
                <ComboBoxItem Content="器械助产" />
            </ComboBox>
            <TextBlock Grid.Column="4" Grid.Row="3" Text="不良习惯：" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource OptionalItemTextBlock}" />
            <TextBox Grid.Column="5" Grid.Row="3" HorizontalAlignment="Left" Width="150" Height="35" Style="{StaticResource InfoTextBox}">
                <TextBox.Text>
                    <Binding Path="MotherBadHabit" Converter="{StaticResource NullableValueBindingConverter}">
                        <Binding.ValidationRules>
                            <validationRule:MotherBadHabitValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
        </Grid>
    </Grid>
</shared:UserControlBase>
